/**
 * 
 */
package com.mindtree.vi.presentation.servlet;

import com.mindtree.vi.business.javaservice.JavaService;
import com.mindtree.vi.business.javaservice.MainMethodInjector;
import com.mindtree.vi.business.javaservice.ServiceCommandType;
import com.mindtree.vi.business.javaservice.ServiceResponse;
import com.mindtree.vi.business.javaservice.SimpleJavaInterpretationService;
import com.mindtree.vi.presentation.annotation.ReferencedBy;
import com.mindtree.vi.xml.XmlTestRequest;
import com.mindtree.vi.xml.XmlTestResponse;
import com.mindtree.vi.xml.config.XmlConfigUtil;

/**
 * @author venkatesh
 * 
 */
public class TestCodeServlet extends
		BaseHttpServlet<XmlTestRequest, XmlTestResponse> {

	private static final long serialVersionUID = 3505117072155034563L;

	@ReferencedBy("compilationService")
	private JavaService interpretationService;

	@Override
	public void process() {

		XmlTestRequest xmlRequeust = getRequest();
		String className = extractClassName(xmlRequeust.getSourceCode());
		MainMethodInjector injector = new MainMethodInjector();
		XmlTestRequest testRequest = new XmlTestRequest();
		testRequest.setSourceCode("mycode");
		ServiceResponse xmlInterpretResponse = (ServiceResponse) interpretationService
				.invokeService(ServiceCommandType.EXECUTE, className);
		XmlTestResponse xmlResponse = new XmlTestResponse();
		setResponse(xmlResponse);
	}
}
